<%-- 
    Document   : Comment
    Created on : 14-08-2014, 10:33:25
    Author     : NGOCLINH-PC
--%>

<%@page import="Data.Event"%>
<%@page import="Data.Member"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Data.Comment"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<div class="primarysanpham">
    <div class="menusanpham">
        <div class="menusanpham1">
           
        </div>
    </div>
    <div class="tablesanpham">
        <div class="tablesanpham1">
            <form action="" method="post" name="frm" id="frm">
                <!--<li style="list-style: none; padding: 10px;"><input style="width: 100px; height: 30px;" type="submit" name="btnxoa" value="Delete"/></li>-->
                <h2 style="padding: 10px; color: #999;">Management Comment</h2>
                <hr />
                <table width="100%" border="1" cellspacing="0" cellpadding="4" id="mytable">
                    <tr>
                        <th scope="col">STT</th>
                        <!--<th scope="col"><input name="cb-sanphamCheckall" type="checkbox" value="" /></th>-->
                        <th scope="col">Member</th>
                        <th scope="col">Event</th>
                        <th scope="col">Date Comment</th>
                        <th scope="col">Content</th>
                        <th scope="col">Status</th>
                        <th scope="col">Actions</th>
                    </tr>
                    <%
                        Comment ct = new Comment();
                        ArrayList<Comment> a = ct.Cmtselect();
                        int k = 1;
                        if (a.size() > 0) {
                            for (int i = 0; i < a.size(); i++) {
                                Comment cmt = a.get(i);

                                out.print("<tr>");
                                out.print("<td>" + k++ + "</td>");
                                //out.print("<td><input name='' type='checkbox' value='' /></td>");
                                Member m = new Member();
                                ArrayList<Member> mb = m.MselectById(cmt.getMemberID());
                                for (int u = 0; u < mb.size(); u++) {
                                    Member ma = mb.get(u);
                                    out.print("<td>" + ma.getUsername() + "</td>");
                                }
                                Event ev = new Event();
                                ArrayList<Event> lsEvent = ev.ESelectByID(cmt.getEventID());
                                for (int e = 0; e < lsEvent.size(); e++) {
                                    Event me = lsEvent.get(e);
                                    out.print("<td>" +me.getEventName() + "</td>");
                                }
                                out.print("<td>" + cmt.getDatecomment() + "</td>");
                                out.print("<td>" + cmt.getContents() + "</td>");
                                 if (cmt.getStatus() == 1) {
                                    out.print("<td><img src='../admin/image/check.png' alt='check' /></td>");
                                } else {
                                    out.print("<td><img src='../admin/image/No_check.png' alt='no_check' /></td>");
                                }
                                out.print("<td><span class='xoa'><a href='index.jsp?page=updateComment&EcmtID=" + cmt.getCommentID() + "'><img src='../admin/image/editBtn.gif' alt='editBtn'  /></a>&nbsp;<a href='../CommentPR?AcmtID=" + cmt.getCommentID() + "' onclick='return confirm(\"Do you want delete!\")'><img src='../admin/image/deleteBtn.gif' alt='deleteBtn' /></a></span></td>");
                                out.print("</tr>");
                            }
                        }
                    %>
                </table>
                <div class="pages"></div>
            </form>
        </div>
    </div>
</div>